package com.aiyige.page.pay.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.aiyige.utils.ListUtil;

import java.util.List;

public class UnpayModel implements Parcelable{
    String id;//	退款手续费订单id
    String orderId;//	订单id
    String userId;//卖家id
    String title;//	退款内容标题
    String subject;//
    List<String> cover;//[array]		退款内容封面
    String status;//	待付款-waitPay,付款成功-paySuccess
    String userFeeDescription;//		手续费说明
    double amount;//		要支付的费用
    String code;//订单号
    String type;//单笔退款手续费 single ，多笔退款手续费 multiple
    String tradeNo;//	流水号
    String refundFeeDetail;// 复制			卖家责任时，卖家同意退款展示。示例：您发布的线下课程 《XXX》因为卖家的原因导致退款，您还需支付第三方支付平台产生的手续费用¥2哦~ | 因为您个人原因导致的退款，需要承担第三方支付平台手续费哦~

    private UnpayModel(Builder builder) {
        setId(builder.id);
        setOrderId(builder.orderId);
        setUserId(builder.userId);
        setTitle(builder.title);
        setSubject(builder.subject);
        setCover(builder.cover);
        setStatus(builder.status);
        setUserFeeDescription(builder.userFeeDescription);
        setAmount(builder.amount);
        setCode(builder.code);
        setType(builder.type);
        setTradeNo(builder.tradeNo);
        setRefundFeeDetail(builder.refundFeeDetail);
    }

    public UnpayModel() {
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public List<String> getCover() {
        return cover;
    }

    public void setCover(List<String> cover) {
        this.cover = cover;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getUserFeeDescription() {
        return userFeeDescription;
    }

    public void setUserFeeDescription(String userFeeDescription) {
        this.userFeeDescription = userFeeDescription;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getTradeNo() {
        return tradeNo;
    }

    public void setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
    }

    public String getRefundFeeDetail() {
        return refundFeeDetail;
    }

    public void setRefundFeeDetail(String refundFeeDetail) {
        this.refundFeeDetail = refundFeeDetail;
    }

    public static final class Builder {
        private String id;
        private String orderId;
        private String userId;
        private String title;
        private String subject;
        private List<String> cover;
        private String status;
        private String userFeeDescription;
        private double amount;
        private String code;
        private String type;
        private String tradeNo;
        private String refundFeeDetail;

        private Builder() {
        }

        public Builder id(String val) {
            id = val;
            return this;
        }

        public Builder orderId(String val) {
            orderId = val;
            return this;
        }

        public Builder userId(String val) {
            userId = val;
            return this;
        }

        public Builder title(String val) {
            title = val;
            return this;
        }

        public Builder subject(String val) {
            subject = val;
            return this;
        }

        public Builder cover(List<String> val) {
            cover = val;
            return this;
        }

        public Builder status(String val) {
            status = val;
            return this;
        }

        public Builder userFeeDescription(String val) {
            userFeeDescription = val;
            return this;
        }

        public Builder amount(double val) {
            amount = val;
            return this;
        }

        public Builder code(String val) {
            code = val;
            return this;
        }

        public Builder type(String val) {
            type = val;
            return this;
        }

        public Builder tradeNo(String val) {
            tradeNo = val;
            return this;
        }

        public Builder refundFeeDetail(String val) {
            refundFeeDetail = val;
            return this;
        }

        public UnpayModel build() {
            return new UnpayModel(this);
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.orderId);
        dest.writeString(this.userId);
        dest.writeString(this.title);
        dest.writeString(this.subject);
        dest.writeStringList(this.cover);
        dest.writeString(this.status);
        dest.writeString(this.userFeeDescription);
        dest.writeDouble(this.amount);
        dest.writeString(this.code);
        dest.writeString(this.type);
        dest.writeString(this.tradeNo);
        dest.writeString(this.refundFeeDetail);
    }

    protected UnpayModel(Parcel in) {
        this.id = in.readString();
        this.orderId = in.readString();
        this.userId = in.readString();
        this.title = in.readString();
        this.subject = in.readString();
        this.cover = in.createStringArrayList();
        this.status = in.readString();
        this.userFeeDescription = in.readString();
        this.amount = in.readDouble();
        this.code = in.readString();
        this.type = in.readString();
        this.tradeNo = in.readString();
        this.refundFeeDetail = in.readString();
    }

    public static final Creator<UnpayModel> CREATOR = new Creator<UnpayModel>() {
        @Override
        public UnpayModel createFromParcel(Parcel source) {
            return new UnpayModel(source);
        }

        @Override
        public UnpayModel[] newArray(int size) {
            return new UnpayModel[size];
        }
    };

    public String getCoverUrl() {
        return ListUtil.isEmpty(cover)?null:cover.get(0);
    }
}
